package com.ideal.blockchain.enums;

public enum MysqlCodeEnum {
    SUCCESS("000000", "请求处理成功"),
    Duplicate_primary_key("000001","主键重复"),
    Unique_constraint("00002","唯一约束错误"),

    ;
    private String code;
    private String desc;

    MysqlCodeEnum(String code, String desc) {

        this.code = code;
        this.desc = desc;
    }

    MysqlCodeEnum() {

    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static MysqlCodeEnum getMysqlCodeEnum(String value) {
        if (value != null) {
            for (MysqlCodeEnum nameEnum : values()) {
                if (nameEnum.getCode().equals(value)) {
                    return nameEnum;
                }
            }
        }
        return null;
    }

    public static boolean isMysqlCodeEnum(String value) {
        if (value != null) {
            for (MysqlCodeEnum nameEnum : values()) {
                if (nameEnum.getCode().equals(value)) {
                    return true;
                }
            }
        }
        return false;
    }
}
